package com.szrt.java.day20161226.demo10;

import java.util.Scanner;

public class CalDemo01 {
	
	
	public static int add(int x ,int y){
		return x+y;
	}
	public static int sub(int x ,int y){
		return x-y;
	}
	public static int mul(int x ,int y){
		return x*y;
	}
	public static int chu(int x ,int y){
		return x/y;
	}
	public static int mo(int x ,int y){
		return x%y;
	}
	
	public static int cal(String flag,int x, int y){
		int jieguo=0;
		switch (flag) {
			case "+":jieguo =add(x,y);break;
			case "-":jieguo =sub(x,y);break;
			case "*":jieguo =mul(x,y);break;
			case "/":jieguo =chu(x,y);break;
			case "%":jieguo =mo(x,y);break;
		}
		return jieguo;
	}
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入第1个数...");
		int x  = sc.nextInt();
		
		System.out.println("请输入符号...");
		String  flag  = sc.next();
		
		
		System.out.println("请输入第2个数...");
		int y = sc.nextInt();
		
		sc.close();
		
		int aa =cal(flag, x, y);
		System.out.println(aa);
		
		
	}

}
